package com.uetoken.cn.adapter;

import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.uetoken.cn.R;
import com.uetoken.cn.adapter.model.FundAssetDetailsModel;
import com.uetoken.cn.utils.Save2DecimalUtils;

import java.util.List;

public class FundAssetDetailsAdapter extends BaseQuickAdapter<FundAssetDetailsModel, BaseViewHolder> {


    public FundAssetDetailsAdapter(int layoutResId, @Nullable List<FundAssetDetailsModel> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FundAssetDetailsModel item) {
        String mBalance = "";
        String money = "";
        String balance = item.getBalanceafter();

        if (item.getTypeid() == 0) {
            //支出
            mBalance = "-" + item.getMoney();
            helper.setTextColor(R.id.moneyTv, ContextCompat.getColor(mContext, R.color.app_color_common_black));
        } else if (item.getTypeid() == 1) {
            //收入
            mBalance = "+" + item.getMoney();
            helper.setTextColor(R.id.moneyTv, ContextCompat.getColor(mContext, R.color.color_app_theme));
        } else {
            mBalance = item.getMoney();
            helper.setTextColor(R.id.moneyTv, ContextCompat.getColor(mContext, R.color.color_app_theme));
        }


        helper.setText(R.id.withdrawDepositTv, item.getWithdrawDeposit());
        helper.setText(R.id.timeWithdrawTv, item.getTimeWithdraw());
        helper.setGone(R.id.balanceTv, item.isShowBalance());
        helper.setText(R.id.balanceTv, mContext.getString(R.string.str_balance_2) + "：" + balance);
        helper.setText(R.id.moneyTv, mBalance);
    }
}
